home *** CD-ROM | disk | FTP | other *** search
/ Clickx 115 / Clickx 115.iso / software / tools / windows / tails-i386-0.16.iso / live / filesystem.squashfs / var / lib / dpkg / info / console-setup.config < prev    next >
Encoding:
Text File  |  2013-01-05  |  21.1 KB  |  1,172 lines

  1. #!/bin/sh
  2.  
  3. #     Copyright ┬⌐ 2005 Anton Zinoviev <anton@lml.bas.bg>
  4.  
  5. #     This program is free software; you can redistribute it and/or modify
  6. #     it under the terms of the GNU General Public License as published by
  7. #     the Free Software Foundation; either version 2 of the License, or
  8. #     (at your option) any later version.
  9.  
  10. #     This program is distributed in the hope that it will be useful,
  11. #     but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. #     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13. #     GNU General Public License for more details.
  14.  
  15. #     If you have not received a copy of the GNU General Public License
  16. #     along with this program, write to the Free Software Foundation, Inc.,
  17. #     59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  18.  
  19. #                        ----------
  20. #                         CONTENTS
  21. #                        ----------
  22. #
  23. # 1. Initialise the variables $fontsets and $charmaps that list all
  24. #    supported fontsets and charmaps.
  25. #
  26. # 2. Function available_fontsets - lists all fontfaces that can be
  27. #    used with $CODESET.
  28. #
  29. # 3. Function available_fontsizes - lists all font sizes that can be
  30. #    used with the $CODESET-$fontface combination.
  31. #
  32. # 4. Functions decode_charmap to decode 'Uni1' to 'Combined - Latin;
  33. #    Slavic Cyrillic; Hebrew; basic Arabic' and encode_charmap for the
  34. #    opposite conversion.
  35. #
  36. # 5. Set $locale.  Extract the strings for the chosen language in $kbdnames.
  37. #
  38. # 6. Compute default values for $CODESET, $FONTFACE, $FONTSIZE, based
  39. #    on the the locale.
  40. #
  41. # 7. Overwrite (some of) the computed default values by the settings
  42. #    in the configuration file (/etc/default/console-setup).
  43. #
  44. # 8. Compute default values for the Debconf questions.
  45. #
  46. # 9. Ask the Debconf questions starting from STATE=1.
  47.  
  48. set -e
  49.  
  50. . /usr/share/debconf/confmodule
  51.  
  52. CONFIGFILE=/etc/default/console-setup
  53.  
  54. default_codeset=''
  55. default_fontface=''
  56. CHARMAP=''
  57. CODESET=''
  58. FONTFACE=''
  59. FONTSIZE=''
  60.  
  61.  
  62. fontsets='Arabic-Fixed15
  63. Arabic-Fixed16
  64. Arabic-VGA14
  65. Arabic-VGA16
  66. Arabic-VGA28x16
  67. Arabic-VGA32x16
  68. Arabic-VGA8
  69. Armenian-Fixed13
  70. Armenian-Fixed14
  71. Armenian-Fixed15
  72. Armenian-Fixed16
  73. Armenian-Fixed18
  74. CyrAsia-Fixed13
  75. CyrAsia-Fixed14
  76. CyrAsia-Fixed15
  77. CyrAsia-Fixed16
  78. CyrAsia-Fixed18
  79. CyrAsia-Terminus12x6
  80. CyrAsia-Terminus14
  81. CyrAsia-Terminus16
  82. CyrAsia-Terminus20x10
  83. CyrAsia-Terminus22x11
  84. CyrAsia-Terminus24x12
  85. CyrAsia-Terminus28x14
  86. CyrAsia-Terminus32x16
  87. CyrAsia-TerminusBold14
  88. CyrAsia-TerminusBold16
  89. CyrAsia-TerminusBold20x10
  90. CyrAsia-TerminusBold22x11
  91. CyrAsia-TerminusBold24x12
  92. CyrAsia-TerminusBold28x14
  93. CyrAsia-TerminusBold32x16
  94. CyrAsia-TerminusBoldVGA14
  95. CyrAsia-TerminusBoldVGA16
  96. CyrKoi-Fixed13
  97. CyrKoi-Fixed14
  98. CyrKoi-Fixed15
  99. CyrKoi-Fixed16
  100. CyrKoi-Fixed18
  101. CyrKoi-Terminus12x6
  102. CyrKoi-Terminus14
  103. CyrKoi-Terminus16
  104. CyrKoi-Terminus20x10
  105. CyrKoi-Terminus22x11
  106. CyrKoi-Terminus24x12
  107. CyrKoi-Terminus28x14
  108. CyrKoi-Terminus32x16
  109. CyrKoi-TerminusBold14
  110. CyrKoi-TerminusBold16
  111. CyrKoi-TerminusBold20x10
  112. CyrKoi-TerminusBold22x11
  113. CyrKoi-TerminusBold24x12
  114. CyrKoi-TerminusBold28x14
  115. CyrKoi-TerminusBold32x16
  116. CyrKoi-TerminusBoldVGA14
  117. CyrKoi-TerminusBoldVGA16
  118. CyrKoi-VGA14
  119. CyrKoi-VGA16
  120. CyrKoi-VGA28x16
  121. CyrKoi-VGA32x16
  122. CyrKoi-VGA8
  123. CyrSlav-Fixed13
  124. CyrSlav-Fixed14
  125. CyrSlav-Fixed15
  126. CyrSlav-Fixed16
  127. CyrSlav-Fixed18
  128. CyrSlav-Terminus12x6
  129. CyrSlav-Terminus14
  130. CyrSlav-Terminus16
  131. CyrSlav-Terminus20x10
  132. CyrSlav-Terminus22x11
  133. CyrSlav-Terminus24x12
  134. CyrSlav-Terminus28x14
  135. CyrSlav-Terminus32x16
  136. CyrSlav-TerminusBold14
  137. CyrSlav-TerminusBold16
  138. CyrSlav-TerminusBold20x10
  139. CyrSlav-TerminusBold22x11
  140. CyrSlav-TerminusBold24x12
  141. CyrSlav-TerminusBold28x14
  142. CyrSlav-TerminusBold32x16
  143. CyrSlav-TerminusBoldVGA14
  144. CyrSlav-TerminusBoldVGA16
  145. CyrSlav-VGA14
  146. CyrSlav-VGA16
  147. CyrSlav-VGA28x16
  148. CyrSlav-VGA32x16
  149. CyrSlav-VGA8
  150. Ethiopian-Fixed15
  151. Ethiopian-Fixed18
  152. Ethiopian-Goha12
  153. Ethiopian-Goha14
  154. Ethiopian-Goha16
  155. Ethiopian-GohaClassic12
  156. Ethiopian-GohaClassic14
  157. Ethiopian-GohaClassic16
  158. Georgian-Fixed13
  159. Georgian-Fixed14
  160. Georgian-Fixed15
  161. Georgian-Fixed16
  162. Georgian-Fixed18
  163. Greek-Fixed13
  164. Greek-Fixed14
  165. Greek-Fixed15
  166. Greek-Fixed16
  167. Greek-Fixed18
  168. Greek-Terminus12x6
  169. Greek-Terminus14
  170. Greek-Terminus16
  171. Greek-Terminus20x10
  172. Greek-Terminus22x11
  173. Greek-Terminus24x12
  174. Greek-Terminus28x14
  175. Greek-Terminus32x16
  176. Greek-TerminusBold14
  177. Greek-TerminusBold16
  178. Greek-TerminusBold20x10
  179. Greek-TerminusBold22x11
  180. Greek-TerminusBold24x12
  181. Greek-TerminusBold28x14
  182. Greek-TerminusBold32x16
  183. Greek-TerminusBoldVGA14
  184. Greek-TerminusBoldVGA16
  185. Greek-VGA14
  186. Greek-VGA16
  187. Greek-VGA28x16
  188. Greek-VGA32x16
  189. Greek-VGA8
  190. Hebrew-Fixed13
  191. Hebrew-Fixed14
  192. Hebrew-Fixed15
  193. Hebrew-Fixed16
  194. Hebrew-Fixed18
  195. Hebrew-VGA14
  196. Hebrew-VGA16
  197. Hebrew-VGA28x16
  198. Hebrew-VGA32x16
  199. Hebrew-VGA8
  200. Lao-Fixed14
  201. Lao-Fixed15
  202. Lao-Fixed16
  203. Lat15-Fixed13
  204. Lat15-Fixed14
  205. Lat15-Fixed15
  206. Lat15-Fixed16
  207. Lat15-Fixed18
  208. Lat15-Terminus12x6
  209. Lat15-Terminus14
  210. Lat15-Terminus16
  211. Lat15-Terminus20x10
  212. Lat15-Terminus22x11
  213. Lat15-Terminus24x12
  214. Lat15-Terminus28x14
  215. Lat15-Terminus32x16
  216. Lat15-TerminusBold14
  217. Lat15-TerminusBold16
  218. Lat15-TerminusBold20x10
  219. Lat15-TerminusBold22x11
  220. Lat15-TerminusBold24x12
  221. Lat15-TerminusBold28x14
  222. Lat15-TerminusBold32x16
  223. Lat15-TerminusBoldVGA14
  224. Lat15-TerminusBoldVGA16
  225. Lat15-VGA14
  226. Lat15-VGA16
  227. Lat15-VGA28x16
  228. Lat15-VGA32x16
  229. Lat15-VGA8
  230. Lat2-Fixed13
  231. Lat2-Fixed14
  232. Lat2-Fixed15
  233. Lat2-Fixed16
  234. Lat2-Fixed18
  235. Lat2-Terminus12x6
  236. Lat2-Terminus14
  237. Lat2-Terminus16
  238. Lat2-Terminus20x10
  239. Lat2-Terminus22x11
  240. Lat2-Terminus24x12
  241. Lat2-Terminus28x14
  242. Lat2-Terminus32x16
  243. Lat2-TerminusBold14
  244. Lat2-TerminusBold16
  245. Lat2-TerminusBold20x10
  246. Lat2-TerminusBold22x11
  247. Lat2-TerminusBold24x12
  248. Lat2-TerminusBold28x14
  249. Lat2-TerminusBold32x16
  250. Lat2-TerminusBoldVGA14
  251. Lat2-TerminusBoldVGA16
  252. Lat2-VGA14
  253. Lat2-VGA16
  254. Lat2-VGA28x16
  255. Lat2-VGA32x16
  256. Lat2-VGA8
  257. Lat38-Fixed13
  258. Lat38-Fixed14
  259. Lat38-Fixed15
  260. Lat38-Fixed16
  261. Lat38-Fixed18
  262. Lat38-VGA14
  263. Lat38-VGA16
  264. Lat38-VGA28x16
  265. Lat38-VGA32x16
  266. Lat38-VGA8
  267. Lat7-Fixed13
  268. Lat7-Fixed14
  269. Lat7-Fixed15
  270. Lat7-Fixed16
  271. Lat7-Fixed18
  272. Lat7-Terminus12x6
  273. Lat7-Terminus14
  274. Lat7-Terminus16
  275. Lat7-Terminus20x10
  276. Lat7-Terminus22x11
  277. Lat7-Terminus24x12
  278. Lat7-Terminus28x14
  279. Lat7-Terminus32x16
  280. Lat7-TerminusBold14
  281. Lat7-TerminusBold16
  282. Lat7-TerminusBold20x10
  283. Lat7-TerminusBold22x11
  284. Lat7-TerminusBold24x12
  285. Lat7-TerminusBold28x14
  286. Lat7-TerminusBold32x16
  287. Lat7-TerminusBoldVGA14
  288. Lat7-TerminusBoldVGA16
  289. Lat7-VGA14
  290. Lat7-VGA16
  291. Lat7-VGA28x16
  292. Lat7-VGA32x16
  293. Lat7-VGA8
  294. Thai-Fixed13
  295. Thai-Fixed14
  296. Thai-Fixed15
  297. Thai-Fixed16
  298. Thai-Fixed18
  299. Uni1-Fixed15
  300. Uni1-Fixed16
  301. Uni1-VGA14
  302. Uni1-VGA16
  303. Uni1-VGA28x16
  304. Uni1-VGA32x16
  305. Uni1-VGA8
  306. Uni2-Fixed13
  307. Uni2-Fixed14
  308. Uni2-Fixed15
  309. Uni2-Fixed16
  310. Uni2-Fixed18
  311. Uni2-Terminus12x6
  312. Uni2-Terminus14
  313. Uni2-Terminus16
  314. Uni2-Terminus20x10
  315. Uni2-Terminus22x11
  316. Uni2-Terminus24x12
  317. Uni2-Terminus28x14
  318. Uni2-Terminus32x16
  319. Uni2-TerminusBold14
  320. Uni2-TerminusBold16
  321. Uni2-TerminusBold20x10
  322. Uni2-TerminusBold22x11
  323. Uni2-TerminusBold24x12
  324. Uni2-TerminusBold28x14
  325. Uni2-TerminusBold32x16
  326. Uni2-TerminusBoldVGA14
  327. Uni2-TerminusBoldVGA16
  328. Uni2-VGA14
  329. Uni2-VGA16
  330. Uni2-VGA28x16
  331. Uni2-VGA32x16
  332. Uni2-VGA8
  333. Uni3-Fixed13
  334. Uni3-Fixed14
  335. Uni3-Fixed15
  336. Uni3-Fixed16
  337. Uni3-Fixed18
  338. Uni3-Terminus12x6
  339. Uni3-Terminus14
  340. Uni3-Terminus16
  341. Uni3-Terminus20x10
  342. Uni3-Terminus22x11
  343. Uni3-Terminus24x12
  344. Uni3-Terminus28x14
  345. Uni3-Terminus32x16
  346. Uni3-TerminusBold14
  347. Uni3-TerminusBold16
  348. Uni3-TerminusBold20x10
  349. Uni3-TerminusBold22x11
  350. Uni3-TerminusBold24x12
  351. Uni3-TerminusBold28x14
  352. Uni3-TerminusBold32x16
  353. Uni3-TerminusBoldVGA14
  354. Uni3-TerminusBoldVGA16
  355. Vietnamese-Fixed13
  356. Vietnamese-Fixed14
  357. Vietnamese-Fixed15
  358. Vietnamese-Fixed16
  359. Vietnamese-Fixed18
  360. '
  361. # fontsets='Arabic-Fixed15
  362. # Arabic-Fixed16
  363. # Arabic-VGA14
  364. # ... 
  365. # Vietnamese-Fixed18
  366. # '
  367.  
  368. charmaps='ARMSCII-8
  369. CP1251
  370. CP1255
  371. CP1256
  372. GEORGIAN-ACADEMY
  373. GEORGIAN-PS
  374. IBM1133
  375. ISIRI-3342
  376. ISO-8859-10
  377. ISO-8859-11
  378. ISO-8859-13
  379. ISO-8859-14
  380. ISO-8859-15
  381. ISO-8859-16
  382. ISO-8859-1
  383. ISO-8859-2
  384. ISO-8859-3
  385. ISO-8859-4
  386. ISO-8859-5
  387. ISO-8859-6
  388. ISO-8859-7
  389. ISO-8859-8
  390. ISO-8859-9
  391. KOI8-R
  392. KOI8-U
  393. TIS-620
  394. VISCII
  395. UTF-8'
  396.  
  397. # charmaps='ARMSCII-8
  398. # CP1251
  399. # CP1255
  400. # ...
  401. # UTF-8'
  402.  
  403. ## CODESETS ##
  404.  
  405. codesets='guess*Guess optimal character set
  406. Arabic*. Arabic
  407. Armenian*# Armenian
  408. CyrKoi*# Cyrillic - KOI8-R and KOI8-U
  409. CyrAsia*# Cyrillic - non-Slavic languages
  410. CyrSlav*# Cyrillic - Slavic languages (also Bosnian and Serbian Latin)
  411. Ethiopian*. Ethiopic
  412. Georgian*# Georgian
  413. Greek*# Greek
  414. Hebrew*# Hebrew
  415. Lao*# Lao
  416. Lat15*# Latin1 and Latin5 - western Europe and Turkic languages
  417. Lat2*# Latin2 - central Europe and Romanian
  418. Lat38*# Latin3 and Latin8 - Chichewa; Esperanto; Irish; Maltese and Welsh
  419. Lat7*# Latin7 - Lithuanian; Latvian; Maori and Marshallese
  420. Vietnamese*. Latin - Vietnamese
  421. Thai*# Thai
  422. Uni1*. Combined - Latin; Slavic Cyrillic; Hebrew; basic Arabic
  423. Uni2*. Combined - Latin; Slavic Cyrillic; Greek
  424. Uni3*. Combined - Latin; Slavic and non-Slavic Cyrillic'
  425.  
  426. db_capb backup
  427.  
  428. available_fontfaces () {
  429.     local prefix
  430.     case "$CODESET" in
  431.         guess) prefix='[^-]*-' ;;
  432.         *) prefix="$CODESET"- ;;
  433.     esac
  434.     echo "$fontsets" | sort | \
  435.     grep "^$prefix" | \
  436.     sed -e "s/^$prefix//" \
  437.         -e 's/[0-9][0-9]*x[0-9][0-9]*$//' \
  438.         -e 's/[0-9]*$//' | \
  439.     sort -n | \
  440.     uniq
  441. }
  442.  
  443. available_fontsizes () {
  444.     local prefix
  445.     case "$CODESET" in
  446.         guess) prefix='[^-]*-' ;;
  447.         *) prefix="$CODESET"- ;;
  448.     esac
  449.     case "$fontface" in
  450.         guess) prefix="$prefix[^0-9]*" ;;
  451.         *) prefix="$prefix$fontface" ;; # this includes fontface=''
  452.     esac
  453.     echo "$fontsets" \
  454.     | grep "^$prefix[0-9]" \
  455.     | sed -e "s/^$prefix//" \
  456.         | sort -n | uniq \
  457.         | while read x; do
  458.               decode_fontsize "$x"
  459.           done \
  460. }
  461.  
  462. db_metaget console-setup/framebuffer_only description
  463. framebuffer_only="$RET"
  464. decode_fontsize () {
  465.     local a b fbonly
  466.     case "$1" in
  467.         8x*)
  468.             echo 8x${1#*x}
  469.             ;;
  470.         *x8)
  471.             echo 8x${1%x*}
  472.             ;;
  473.         *x*)
  474.             a=${1#*x}
  475.             b=${1%x*}
  476.             if [ "$a" -lt "$b" ]; then
  477.                 echo ${a}x${b} "($framebuffer_only)"
  478.             else
  479.                 echo ${b}x${a} "($framebuffer_only)"
  480.             fi
  481.             ;;
  482.         *)
  483.             echo 8x$1
  484.             ;;
  485.     esac
  486. }
  487.  
  488. encode_fontsize () {
  489.     echo $1 | sed -e 's/[\, ;].*//'
  490. }
  491.  
  492. decode_codeset () {
  493.     echo "$codesets" | \
  494.     grep -F "$**" | \
  495.     sed 's/.*[*]//'
  496. }
  497.  
  498. encode_codeset () {
  499.     echo "$codesets" | \
  500.     grep -F "*$*" | \
  501.     sed 's/[*].*//'
  502. }
  503.  
  504. kernel=unknown
  505. if which uname >/dev/null; then
  506.     case "`uname`" in
  507.         *Linux*) kernel=linux ;;
  508.         *FreeBSD*) kernel=freebsd ;;
  509.     esac
  510. fi
  511.  
  512. if type locale 2>/dev/null >/dev/null; then
  513.     eval `locale`
  514. fi
  515.  
  516. if [ "$LC_CTYPE"  -a "$LC_CTYPE" != C ]; then
  517.     locale=$LC_CTYPE
  518. elif db_get debian-installer/locale && [ "$RET" ]; then
  519.     locale="$RET"
  520. else
  521.     locale=C
  522. fi
  523.  
  524. if [ "$locale" = C ]; then
  525.     CHARMAP=ISO-8859-15
  526.     charmap_priority=high
  527. elif type locale 2>/dev/null >/dev/null; then
  528.     CHARMAP=`locale charmap`
  529. else
  530.     CHARMAP=unknown
  531. fi
  532. if echo "$charmaps" | grep "$CHARMAP" >/dev/null; then
  533.     charmap_priority=low
  534. else
  535.     CHARMAP=UTF-8
  536.     charmap_priority=high
  537. fi
  538.  
  539. case "$locale" in
  540.     *KOI8*|*koi8*)
  541.     CODESET=CyrKoi
  542.     codeset_priority=low
  543.     ;;
  544.     aa_*)
  545.     CODESET=Lat15
  546.     codeset_priority=low
  547.     ;;
  548.     af_*)
  549.     CODESET=Lat15
  550.     codeset_priority=low
  551.     ;;
  552.     am_*)
  553.     CODESET=Ethiopic
  554.     codeset_priority=low
  555.     ;;
  556.     an_*)
  557.     CODESET=Lat15
  558.     codeset_priority=low
  559.     ;;
  560.     ar_*)
  561.     CODESET=Arabic
  562.     codeset_priority=low
  563.     ;;
  564.     ast_*)
  565.     CODESET=Lat15
  566.     codeset_priority=low
  567.     ;;
  568.     az_*)
  569.     CODESET=Uni3
  570.     codeset_priority=low
  571.     ;;
  572.     be_*)
  573.     CODESET=CyrSlav
  574.     codeset_priority=low
  575.     ;;
  576.     bg_*)
  577.     CODESET=CyrSlav
  578.     codeset_priority=low
  579.     ;;
  580.     bn_*)
  581.     CODESET=unsupported
  582.     codeset_priority=low
  583.     ;;
  584.     br_*)
  585.     CODESET=Lat15
  586.     codeset_priority=low
  587.     ;;
  588.     bs_*)
  589.     CODESET=Uni3
  590.     codeset_priority=low
  591.     ;;
  592.     byn_*)
  593.     CODESET=Ethiopian
  594.     codeset_priority=low
  595.     ;;
  596.     ca_*)
  597.     CODESET=Lat15
  598.     codeset_priority=low
  599.     ;;
  600.     cs_*)
  601.     CODESET=Lat2
  602.     codeset_priority=low
  603.     ;;
  604.     cy_*)
  605.     CODESET=Lat38
  606.     codeset_priority=low
  607.     ;;
  608.     da_*)
  609.     CODESET=Lat15
  610.     codeset_priority=low
  611.     ;;
  612.     de_*)
  613.     CODESET=Lat15
  614.     codeset_priority=low
  615.     ;;
  616.     el_*)
  617.     CODESET=Greek
  618.     codeset_priority=low
  619.     ;;
  620.     en_*)
  621.     CODESET=Lat15
  622.     codeset_priority=low
  623.     ;;
  624.     eo|eo.*|eo_*|eo\@*)
  625.     CODESET=Lat38
  626.     codeset_priority=low
  627.     ;;
  628.     es_*)
  629.     CODESET=Lat15
  630.     codeset_priority=low
  631.     ;;
  632.     et_*)
  633.     CODESET=Lat15
  634.     codeset_priority=low
  635.     ;;
  636.     eu_*)
  637.     CODESET=Lat15
  638.     codeset_priority=low
  639.     ;;
  640.     fa_*)
  641.     CODESET=Arabic
  642.     codeset_priority=low
  643.     ;;
  644.     fi_*)
  645.     CODESET=Lat15
  646.     codeset_priority=low
  647.     ;;
  648.     fo_*)
  649.     CODESET=Lat15
  650.     codeset_priority=low
  651.     ;;
  652.     fr_*)
  653.     CODESET=Lat15
  654.     codeset_priority=low
  655.     ;;
  656.     ga_*)
  657.     CODESET=Lat38
  658.     codeset_priority=low
  659.     ;;
  660.     gd_*)
  661.     CODESET=Lat15
  662.     codeset_priority=low
  663.     ;;
  664.     gez_*)
  665.     CODESET=Ethiopian
  666.     codeset_priority=low
  667.     ;;
  668.     gl_*)
  669.     CODESET=Lat15
  670.     codeset_priority=low
  671.     ;;
  672.     gu_*)
  673.     CODESET=unsupported
  674.     codeset_priority=low
  675.     ;;
  676.     gv_*)
  677.     CODESET=Lat15
  678.     codeset_priority=low
  679.     ;;
  680.     he_*)
  681.     CODESET=Hebrew
  682.     codeset_priority=low
  683.     ;;
  684.     hi_*)
  685.     CODESET=unsupported
  686.     codeset_priority=low
  687.     ;;
  688.     hr_*)
  689.     CODESET=Lat2
  690.     codeset_priority=low
  691.     ;;
  692.     hu_*)
  693.     CODESET=Lat2
  694.     codeset_priority=low
  695.     ;;
  696.     hy_*)
  697.     CODESET=Armenian
  698.     codeset_priority=low
  699.     ;;
  700.     id_*)
  701.     CODESET=Lat15
  702.     codeset_priority=low
  703.     ;;
  704.     is_*)
  705.     CODESET=Lat15
  706.     codeset_priority=low
  707.     ;;
  708.     it_*)
  709.     CODESET=Lat15
  710.     codeset_priority=low
  711.     ;;
  712.     iw_*)
  713.     CODESET=Hebrew
  714.     codeset_priority=low
  715.     ;;
  716.     ja_*)
  717.     CODESET=unsupported
  718.     codeset_priority=low
  719.     ;;
  720.     ka_*)
  721.     CODESET=Georgian
  722.     codeset_priority=low
  723.     ;;
  724.     kl_*)
  725.     CODESET=Lat15
  726.     codeset_priority=low
  727.     ;;
  728.     kn_*)
  729.     CODESET=unsupported
  730.     codeset_priority=low
  731.     ;;
  732.     ko_*)
  733.     CODESET=unsupported
  734.     codeset_priority=low
  735.     ;;
  736.     kw_*)
  737.     CODESET=Lat15
  738.     codeset_priority=low
  739.     ;;
  740.     lg_*)
  741.     CODESET=Lat15 # TODO: This must be ISO-8859-10 (Latin6)
  742.     codeset_priority=low
  743.     ;;
  744.     lo_*)
  745.     CODESET=Lao
  746.     codeset_priority=low
  747.     ;;
  748.     lt_*)
  749.     CODESET=Lat7
  750.     codeset_priority=low
  751.     ;;
  752.     lv_*)
  753.     CODESET=Lat7
  754.     codeset_priority=low
  755.     ;;
  756.     ky_*)
  757.     CODESET=CyrAsia
  758.     codeset_priority=low
  759.     ;;
  760.     mi_*)
  761.     CODESET=Lat7
  762.     codeset_priority=low
  763.     ;;
  764.     mk_*)
  765.     CODESET=CyrSlav
  766.     codeset_priority=low
  767.     ;;
  768.     ml_*)
  769.     CODESET=unsupported
  770.     codeset_priority=low
  771.     ;;
  772.     mn_*)
  773.     CODESET=CyrAsia
  774.     codeset_priority=low
  775.     ;;
  776.     mr_*)
  777.     CODESET=unsupported
  778.     codeset_priority=low
  779.     ;;
  780.     ms_*)
  781.     CODESET=Lat15 # TODO: Is this correct? (Malay language)
  782.     codeset_priority=low
  783.     ;;
  784.     mt_*)
  785.     CODESET=Lat38
  786.     codeset_priority=low
  787.     ;;
  788.     nb_*)
  789.     CODESET=Lat15
  790.     codeset_priority=low
  791.     ;;
  792.     ne_*)
  793.     CODESET=unsupported
  794.     codeset_priority=low
  795.     ;;
  796.     nl_*)
  797.     CODESET=Lat15
  798.     codeset_priority=low
  799.     ;;
  800.     nn_*)
  801.     CODESET=Lat15
  802.     codeset_priority=low
  803.     ;;
  804.     oc_*)
  805.     CODESET=Lat15
  806.     codeset_priority=low
  807.     ;;
  808.     om_*)
  809.     CODESET=Lat15
  810.     codeset_priority=low
  811.     ;;
  812.     pa_*)
  813.     CODESET=unsupported
  814.     codeset_priority=low
  815.     ;;
  816.     pl_*)
  817.     CODESET=Lat2
  818.     codeset_priority=low
  819.     ;;
  820.     pt_*)
  821.     CODESET=Lat15
  822.     codeset_priority=low
  823.     ;;
  824.     ro_*)
  825.     CODESET=Lat2
  826.     codeset_priority=low
  827.     ;;
  828.     ru_*)
  829.     CODESET=CyrSlav
  830.     codeset_priority=low
  831.     ;;
  832.     se_*)
  833.     CODESET=Uni1
  834.     codeset_priority=low
  835.     ;;
  836.     sid_*)
  837.     CODESET=Lat15 # TODO: Is this correct? (Sidama language)
  838.     codeset_priority=low
  839.     ;;
  840.     sk_*)
  841.     CODESET=Lat2
  842.     codeset_priority=low
  843.     ;;
  844.     sl_*)
  845.     CODESET=Lat2
  846.     codeset_priority=low
  847.     ;;
  848.     so_*)
  849.     CODESET=Lat15
  850.     codeset_priority=low
  851.     ;;
  852.     sq_*)
  853.     CODESET=Lat15
  854.     codeset_priority=low
  855.     ;;
  856.     sr_*)
  857.     CODESET=CyrSlav
  858.     codeset_priority=low
  859.     ;;
  860.     st_*)
  861.     CODESET=Lat15 # TODO: Is this correct? (Sotho language)
  862.     codeset_priority=low
  863.     ;;
  864.     sv_*)
  865.     CODESET=Lat15
  866.     codeset_priority=low
  867.     ;;
  868.     ta_*)
  869.     CODESET=unsupported
  870.     codeset_priority=low
  871.     ;;
  872.     te_*)
  873.     CODESET=unsupported
  874.     codeset_priority=low
  875.     ;;
  876.     tg_*)
  877.     CODESET=CyrAsia
  878.     codeset_priority=low
  879.     ;;
  880.     th_*)
  881.     CODESET=Thai
  882.     codeset_priority=low
  883.     ;;
  884.     ti_*)
  885.     CODESET=Ethiopian
  886.     codeset_priority=low
  887.     ;;
  888.     tig_*)
  889.     CODESET=Ethiopian
  890.     codeset_priority=low
  891.     ;;
  892.     tl_*)
  893.     CODESET=Lat15
  894.     codeset_priority=low
  895.     ;;
  896.     tr_*)
  897.     CODESET=Lat15
  898.     codeset_priority=low
  899.     ;;
  900.     tt_*)
  901.     CODESET=Lat15 # TODO: Is this correct? (Tatar language)
  902.     codeset_priority=low
  903.     ;;
  904.     uk_*)
  905.     CODESET=CyrSlav
  906.     codeset_priority=low
  907.     ;;
  908.     ur_*)
  909.     CODESET=Arabic
  910.     codeset_priority=low
  911.     ;;
  912.     uz_*)
  913.     CODESET=Lat15 # TODO: Is this correct? (Uzbek language)
  914.     codeset_priority=low
  915.     ;;
  916.     uz_*\@cyrillic)
  917.     CODESET=CyrAsia
  918.     codeset_priority=low
  919.     ;;
  920.     vi_*)
  921.     CODESET=Vietnamese
  922.     codeset_priority=low
  923.     ;;
  924.     wa_*)
  925.     CODESET=Lat15
  926.     codeset_priority=low
  927.     ;;
  928.     xh_*)
  929.     CODESET=Lat15
  930.     codeset_priority=low
  931.     ;;
  932.     yi_*)
  933.     CODESET=Hebrew
  934.     codeset_priority=low
  935.     ;;
  936.     zh_*)
  937.     CODESET=unsupported
  938.     codeset_priority=low
  939.     ;;
  940.     zu_*)
  941.     CODESET=Lat15
  942.     codeset_priority=low
  943.     ;;
  944.     *)
  945.     CODESET=guess
  946.         if [ "$CHARMAP" = UTF-8 ]; then
  947.         codeset_priority=high
  948.         else
  949.             # for 8-bit encodings we can guess good codeset
  950.         codeset_priority=low
  951.         fi
  952.     ;;
  953. esac
  954. if [ "$CODESET" = unsupported ]; then
  955.     CODESET=guess
  956. fi
  957.  
  958. case "$CODESET" in
  959.     Arabic)
  960.     FONTFACE=VGA
  961.     ;;
  962.     Armenian)
  963.     FONTFACE=Fixed
  964.     ;;
  965.     CyrAsia)
  966.     FONTFACE=Fixed
  967.     ;;
  968.     CyrKoi)
  969.     FONTFACE=VGA
  970.     ;;
  971.     CyrSlav)
  972.     FONTFACE=Fixed
  973.     ;;
  974.     Ethiopian)
  975.     FONTFACE=Goha
  976.     ;;
  977.     Georgian)
  978.     FONTFACE=Fixed
  979.     ;;
  980.     Greek)
  981.     FONTFACE=Fixed
  982.     ;;
  983.     Hebrew)
  984.     FONTFACE=Fixed
  985.     ;;
  986.     Lao)
  987.     FONTFACE=Fixed
  988.     ;;
  989.     Lat15)
  990.     FONTFACE=Fixed
  991.     ;;
  992.     Lat2)
  993.     FONTFACE=Fixed
  994.     ;;
  995.     Lat38)
  996.     FONTFACE=Fixed
  997.     ;;
  998.     Lat7)
  999.     FONTFACE=Fixed
  1000.     ;;
  1001.     Thai)
  1002.     FONTFACE=Fixed
  1003.     ;;
  1004.     Uni1)
  1005.     FONTFACE=VGA
  1006.     ;;
  1007.     Uni2)
  1008.     FONTFACE=Fixed
  1009.     ;;
  1010.     Uni3)
  1011.     FONTFACE=Fixed
  1012.     ;;
  1013.     Vietnamese)
  1014.     FONTFACE=Fixed
  1015.     ;;
  1016.     *)
  1017.     FONTFACE=Fixed
  1018.     ;;
  1019. esac
  1020.  
  1021. FONTSIZE=16
  1022.  
  1023. ### READ THE DEFAULTS ##################################################
  1024.  
  1025. # Load the config file, if it exists.
  1026. if [ -e $CONFIGFILE ]; then
  1027.     . $CONFIGFILE || true
  1028. fi
  1029.  
  1030. # Compute default values for the Debconf questions
  1031.  
  1032. if [ "$CODESET" ]; then
  1033.     default_codeset="$(decode_codeset "$CODESET")"
  1034. fi
  1035.  
  1036. if [ "$FONTFACE" = guess ]; then
  1037.     db_metaget console-setup/guess_font description
  1038.     default_fontface="$RET"
  1039. elif [ "$FONTFACE" ]; then
  1040.     default_fontface="$FONTFACE"
  1041. else
  1042.     db_metaget console-setup/use_system_font description
  1043.     default_fontface="$RET"
  1044. fi
  1045.  
  1046. if [ "$FONTSIZE" = guess -a "$FONTFACE" != guess ]; then
  1047.     # this combination is currently unsupported
  1048.     FONTSIZE=16
  1049. fi
  1050. if [ "$FONTFACE" ]; then
  1051.     FONTSIZE=${FONTSIZE:-16}
  1052. fi
  1053.  
  1054. # Store the default values into debconf db.  Workaround #352697.
  1055. db_get console-setup/store_defaults_in_debconf_db
  1056. if [ "$RET" = true ]; then
  1057.     db_set console-setup/charmap47 "$CHARMAP"
  1058.     db_set console-setup/codeset47 "$default_codeset"
  1059.     db_set console-setup/fontface47 "$default_fontface"
  1060.     fontsizetext="`decode_fontsize $FONTSIZE`"
  1061.     db_set console-setup/fontsize-text47 "$fontsizetext"
  1062.     db_set console-setup/fontsize-fb47 "$fontsizetext"
  1063.     db_set console-setup/fontsize "$fontsizetext"
  1064.  
  1065.     db_set console-setup/store_defaults_in_debconf_db false
  1066. fi
  1067.  
  1068. #######################################################################
  1069.  
  1070. STATE=1
  1071. old_state=0
  1072. while :; do
  1073.     starting_state=$STATE
  1074.     case "$STATE" in
  1075.     1)
  1076.             # add commas
  1077.         choices=`echo "$charmaps" | sed -e 's/$/,/g' | sort `
  1078.         # remove newlines
  1079.         choices=`echo $choices | sed -e 's/,$//' `
  1080.         db_subst console-setup/charmap47 CHOICES "$choices"
  1081.         db_input $charmap_priority console-setup/charmap47 || true
  1082.         if db_go; then
  1083.         STATE=$(($STATE + 1))
  1084.         else
  1085.         STATE=$(($STATE - 1))
  1086.         fi
  1087.         ;;
  1088.     2)
  1089.         db_input $codeset_priority console-setup/codeset47 || true
  1090.         if db_go; then
  1091.         db_get console-setup/codeset47
  1092.         CODESET="$(encode_codeset "$RET")"
  1093.         db_set console-setup/codesetcode "$CODESET"
  1094.         STATE=$(($STATE + 1))
  1095.         else
  1096.         STATE=$(($STATE - 1))
  1097.         fi
  1098.         ;;
  1099.     3)
  1100.         fontfaces=`available_fontfaces`
  1101.         # add commas
  1102.         choices=`echo "$fontfaces" | sed -e 's/$/,/g'`
  1103.         # remove newlines
  1104.         choices=`echo $choices | sed -e 's/,$//'`
  1105.         db_metaget console-setup/use_system_font description
  1106.         choices="$choices, $RET"
  1107.         db_metaget console-setup/guess_font description
  1108.         choices="$choices, $RET"
  1109.         db_subst console-setup/fontface47 CHOICES "$choices"
  1110.         db_input medium console-setup/fontface47 || true
  1111.         if db_go; then
  1112.         STATE=$(($STATE + 1))
  1113.         else
  1114.         STATE=$(($STATE - 1))
  1115.         fi
  1116.         db_get console-setup/fontface47
  1117.         fontface=$RET
  1118.         db_metaget console-setup/use_system_font description
  1119.         if [ "$fontface" = "$RET" ]; then
  1120.         fontface=''
  1121.         fi
  1122.         db_metaget console-setup/guess_font description
  1123.         if [ "$fontface" = "$RET" ]; then
  1124.         fontface=guess
  1125.         fi
  1126.         ;;
  1127.     4)
  1128.             if [ "$kernel" = freebsd ]; then
  1129.             db_set console-setup/fontsize "$FONTSIZE"
  1130.         # skip the question without making Debconf loop
  1131.         STATE=$(( $STATE + $STATE - $old_state ))
  1132.             else
  1133.             fontsizes=`available_fontsizes`
  1134.             # add commas
  1135.             choices=`echo "$fontsizes" | sed -e 's/$/,/g' `
  1136.             # remove newlines and the last comma
  1137.             choices=`echo $choices | sed -e 's/,$//'`
  1138.             if [ -n "$choices" -a "$FONTSIZE" != guess ]; then
  1139.             if echo "$choices" | grep -q x; then
  1140.                 size_template=console-setup/fontsize-fb47
  1141.             else
  1142.                 size_template=console-setup/fontsize-text47
  1143.             fi
  1144.             db_subst $size_template CHOICES "$choices"
  1145.             db_input medium $size_template || true
  1146.             if db_go; then
  1147.                 STATE=$(($STATE + 1))
  1148.             else
  1149.                 STATE=$(($STATE - 1))
  1150.             fi
  1151.             db_get $size_template
  1152.             FONTSIZE=`encode_fontsize "$RET"`
  1153.             else
  1154.                     FONTSIZE=${choices:+guess}
  1155.             STATE=$(( $STATE + $STATE - $old_state ))
  1156.                 fi
  1157.             db_set console-setup/fontsize "$FONTSIZE"
  1158.         fi
  1159.         ;;
  1160.     *)
  1161.         break
  1162.         ;;
  1163.     esac
  1164.     old_state=$starting_state
  1165. done
  1166.  
  1167. if [ $STATE -eq 0 ]; then
  1168.     exit 10
  1169. fi
  1170.  
  1171. exit 0
  1172.